package com.bjsxt.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bjsxt.domain.TurnoverOrder;
import com.bjsxt.mapper.TurnoverOrderMapper;
import com.bjsxt.service.TurnoverOrderService;
@Service
public class TurnoverOrderServiceImpl extends ServiceImpl<TurnoverOrderMapper, TurnoverOrder> implements TurnoverOrderService{

    @Override
    public Page<TurnoverOrder> findByPage(Page<TurnoverOrder> page, Long userId, String symbol, Integer type) {
        return page(page,new LambdaQueryWrapper<TurnoverOrder>()
                .eq(TurnoverOrder::getBuyUserId,userId)
                    .eq(TurnoverOrder::getSymbol,symbol)
                .eq(TurnoverOrder::getTradeType,type)


        );
    }

    @Override
    public List<TurnoverOrder> findSymbol(String symbol) {
        return list(new LambdaQueryWrapper<TurnoverOrder>().eq(TurnoverOrder::getSymbol,symbol).orderByDesc(TurnoverOrder::getCreated).eq(TurnoverOrder::getStatus,1).last("limit 60"));
    }
}
